<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数式组件</title>
    <style>
        header{
            height: 100px;
            background: #aef;
        }
        main{
            height: 400px;
            background: #fec;
        }
        footer{
            height: 100px;
            background: rgb(30, 128, 69)
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        //函数式组件 
        function Top(){ //首字母一定要大写
            //返回虚拟 DOM 对象
            return <header></header>
        }

        //内容区组件
        function Content(){
            return <main></main>
        }

        //底部区组件
        function Bottom(){
            return <footer></footer>
        }

        // <Top></Top>  React 会自动寻找与 Top 同名的『函数』, 执行函数返回『虚拟 DOM 对象』, 最终渲染
        function App(){
            return <div>
                <Top></Top>
                <Content />
                <Bottom />
            </div>;
        }
        
        
        ReactDOM.render(<App />, document.querySelector("#root"));
    </script>
</body>
</html>